package com.scheduling.common.constants;

/**
 * 公共常量类
 *
 * @author 开发团队
 * @since 2025-05-29
 */
public class CommonConstants {

    /**
     * 系统相关常量
     */
    public static final String SYSTEM_NAME = "智能排产系统";
    public static final String SYSTEM_VERSION = "1.0.0";

    /**
     * 字符编码
     */
    public static final String UTF8 = "UTF-8";

    /**
     * HTTP 请求相关
     */
    public static final String CONTENT_TYPE_JSON = "application/json;charset=UTF-8";
    public static final String AUTHORIZATION_HEADER = "Authorization";
    public static final String BEARER_PREFIX = "Bearer ";

    /**
     * 通用状态
     */
    public static final Integer STATUS_ENABLED = 1;
    public static final Integer STATUS_DISABLED = 0;

    /**
     * 删除标记
     */
    public static final Integer DELETED_TRUE = 1;
    public static final Integer DELETED_FALSE = 0;

    /**
     * 通用字符串
     */
    public static final String YES = "Y";
    public static final String NO = "N";
    public static final String SUCCESS = "success";
    public static final String FAIL = "fail";

    /**
     * 数据权限
     */
    public static final String DATA_SCOPE_ALL = "1";
    public static final String DATA_SCOPE_DEPT = "2";
    public static final String DATA_SCOPE_SELF = "3";

    /**
     * 分页相关
     */
    public static final Integer DEFAULT_PAGE_SIZE = 10;
    public static final Integer MAX_PAGE_SIZE = 1000;

    /**
     * 缓存相关
     */
    public static final String CACHE_PREFIX = "scheduling:";
    public static final String USER_CACHE_PREFIX = CACHE_PREFIX + "user:";
    public static final String TOKEN_CACHE_PREFIX = CACHE_PREFIX + "token:";
    public static final String CAPTCHA_CACHE_PREFIX = CACHE_PREFIX + "captcha:";

    /**
     * 时间相关（秒）
     */
    public static final Integer TOKEN_EXPIRE_TIME = 7200;  // 2小时
    public static final Integer CAPTCHA_EXPIRE_TIME = 300; // 5分钟
    public static final Integer CACHE_EXPIRE_TIME = 1800;  // 30分钟

    /**
     * 排产相关常量
     */
    public static final String ALGORITHM_MAX_UTILIZATION = "MAX_UTILIZATION";
    public static final String ALGORITHM_BATCH_PRODUCTION = "BATCH_PRODUCTION";
    public static final String ALGORITHM_URGENT_FIRST = "URGENT_FIRST";

    /**
     * 订单状态
     */
    public static final String ORDER_STATUS_PENDING = "PENDING";      // 待生产
    public static final String ORDER_STATUS_PRODUCING = "PRODUCING";  // 生产中
    public static final String ORDER_STATUS_COMPLETED = "COMPLETED";  // 已完成
    public static final String ORDER_STATUS_CANCELLED = "CANCELLED";  // 已取消

    /**
     * 工单状态
     */
    public static final String WORK_ORDER_STATUS_PENDING = "PENDING";      // 待排产
    public static final String WORK_ORDER_STATUS_SCHEDULED = "SCHEDULED";  // 已排产
    public static final String WORK_ORDER_STATUS_PRODUCING = "PRODUCING";  // 生产中
    public static final String WORK_ORDER_STATUS_COMPLETED = "COMPLETED";  // 已完成
    public static final String WORK_ORDER_STATUS_CANCELLED = "CANCELLED";  // 已取消

    /**
     * 生产任务状态
     */
    public static final String TASK_STATUS_UNASSIGNED = "UNASSIGNED";  // 待分配
    public static final String TASK_STATUS_ASSIGNED = "ASSIGNED";      // 已分配
    public static final String TASK_STATUS_RUNNING = "RUNNING";        // 进行中
    public static final String TASK_STATUS_COMPLETED = "COMPLETED";    // 已完成

    /**
     * 机器状态
     */
    public static final String MACHINE_STATUS_IDLE = "空闲";           // 空闲
    public static final String MACHINE_STATUS_RUNNING = "生产中";     // 运行中


    /**
     * 优先级
     */
    public static final Integer PRIORITY_HIGH = 1;
    public static final Integer PRIORITY_MEDIUM = 2;
    public static final Integer PRIORITY_LOW = 3;

    /**
     * 时间格式
     */
    public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static final String DATE_FORMAT = "yyyy-MM-dd";
    public static final String TIME_FORMAT = "HH:mm:ss";

    /**
     * 私有构造函数，防止实例化
     */
    private CommonConstants() {
        throw new UnsupportedOperationException("常量类不能被实例化");
    }
} 